package com.ming.elm.dao;

import java.util.List;

import com.ming.elm.po.Cart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface CartDao {

	@Insert("INSERT INTO cart(foodId,businessId,userId,quantity) VALUES (#{foodId},#{businessId},#{userId},#{quantity})")
	int saveCart(Cart cart) throws Exception;
	@Update("UPDATE cart SET quantity = #{quantity} WHERE userId = #{userId} AND businessId = #{businessId} AND foodId = #{foodId}")
	int updateCart(Cart cart) throws Exception;
	// @Delete("DELETE FROM cart WHERE userId = #{userId} AND businessId = #{businessId} AND foodId = #{foodId}")
	int removeCart(Cart cart) throws Exception;

	// @Select("SELECT * FROM cart WHERE businessId=#{businessId} AND userId=#{userId}")
	List<Cart> listCart(Cart cart) throws Exception;
}
